import Qs from './qs'

const BASE_URL = 'http://192.168.234:13000/api'
const request = (options) => {
    option.url = BASE_URL + options.url
    return new Promise((resolve, reject) => {
        console.log("ajax ===> " + JSON.stringify(options))
        api.ajax(options, (ret, err) => {
            console.log(JSON.stringify("ret ===>" + ret))
            if (ret) {
                resolve(ret)
            } else {
                reject(err)
            }
        })
    })
}

const GET = (url, params) => {
    if (params) {
        url = url + '?' + Qs.stringify(params, { allowDots: true, arrayFormat: 'indices' })
    }
    return request({
        ...options, url, method: 'GET'
    })
}

const POST = () => {

}

const POST_